Generate supported-languages table from /v3/languages#395
Open
lilkraftwerk wants to merge 10 commits into
Open
Generate supported-languages table from /v3/languages#395lilkraftwerk wants to merge 10 commits into
lilkraftwerk wants to merge 10 commits into
Conversation
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
added 10 commits
July 10, 2026 12:26
Replace the hand-maintained languageData array in the language table snippet with output generated from GET /v3/languages, and add the generator script. The array now sits between BEGIN/END GENERATED markers; run node scripts/generate-language-table.mjs to refresh it.
Split the generator into one script per target with a parent that runs all of them (scripts/update-language-docs.mjs). New generated blocks: the Voice API language matrix and its service-specification lists, the formality sentences on translate and document, the target_lang, writing_style and tone lists on improve-text, and the style-rules language mentions. Generated blocks sit between BEGIN/END GENERATED markers; everything outside them stays hand-written.
Formality and write language lists are now grouped by base language and sorted alphabetically. Shared joinList handles one- and two-item lists, the marker regex escapes ids and anchors on the trailing space, the parent script reports partial-update state on failure, and the voice generator warns if a target-only language would be missing from the matrix. Restores the pt-PT scope caveat on the service specification page and the final conjunction in the style-rules callout.
Tests run with Node's built-in runner (node --test scripts/*.test.mjs), covering joinList edge cases, groupByBase grouping and ordering, the marker-replacement core (extracted as pure replaceGeneratedBlock), voice matrix symbols, and the grouped bullet renderer. A GitHub workflow runs them on PRs touching scripts/.
Scheduled (plus manual dispatch) workflow that reruns the generators against /v3/languages and opens a PR when anything changed. The git and PR logic lives in scripts/open-sync-pr.sh, which refuses to run outside CI. Requires a DEEPL_API_KEY repo secret; use a dedicated cost-capped key. Repeated drift updates the same bot branch and PR.
The translate and document overview pages are now OpenAPI stubs, so the formality lists and the translate-page style-rules mention have no docs home anymore; drop that generator and target. The voice matrix moved to docs/voice/supported-languages-formats-and-limits.mdx.
…n now live Prod /v3/languages now reports the expanded style-rules and translation-memory language support, so the generated table and callout pick it up.
cf43af6 to
f63866c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Based on #396 and merges after it; the base branch will flip back to
mainautomatically when that PR lands.What
Language-support info across the docs was hand-maintained and drifting from what the API reports. This PR makes it generated from
GET /v3/languages.One script per target, plus a parent that updates everything:
generate-language-table.mjsgenerate-voice-languages.mjsgenerate-write-lists.mjstarget_lang/writing_style/tonelists on improve-textgenerate-style-rules-lists.mjsGenerated content sits between
BEGIN/END GENERATEDmarkers; everything outside stays hand-written. Each script also runs standalone. The API key is passed as an argument, never stored. SetDEEPL_SERVER_URLto run against a mock. The OpenAPI spec is untouched.A daily workflow (
sync-language-docs.yml) reruns the generators against the live API and opens/updates a bot PR when anything drifts, so future language launches show up as a reviewable diff without anyone remembering to run the script.Earlier revisions also generated the formality lists on the translate/document pages and a style-rules mention on translate; those pages became OpenAPI stubs in #396, so that generator was dropped.
Notable data changes (all now match the live API)
/v3/languages)DE-DE/FR-FRvariants,DE-CH/FR-CAcorrected,EN/ZH/PT-PTgain text improvementen/ptandzh-Hantper the API;writing_style/tonelists gain baseptNorwegian (bokmål)naming, alphabetical order); the service-specification lists gain the beta languageshi,ms,taand baseen/zhas text targetsRegenerating after future API changes is one command and a reviewable diff.